#include "stdio.h"
#include "string.h"

int main(){
    int xishu[10001]={0};
    int xishu_c=0;
    int zhishu[10001]={0};
    int zhishu_c = 0;
    int temp_x = 0;
    int temp_z = 0;
    char ch;
    scanf("%d%d",&temp_x,&temp_z);
    if(temp_z!=0){
        xishu[xishu_c++]=temp_x;
        zhishu[zhishu_c++]=temp_z;
    }
    scanf("%c",&ch);
    while (ch!='\n'){
        scanf("%d%d",&temp_x,&temp_z);
        if(temp_z!=0){
            xishu[xishu_c++]=temp_x;
            zhishu[zhishu_c++]=temp_z;
        }
        scanf("%c",&ch);
    }
    for (int i = 0; i < xishu_c; ++i) {
        int temp = zhishu[i];
        zhishu[i] = zhishu[i]-1;
        xishu[i] = xishu[i]*temp;
    }
    for (int i = 0; i < xishu_c-1; ++i) {
        printf("%d ",xishu[i]);
        printf("%d ",zhishu[i]);
    }
    printf("%d ",xishu[xishu_c-1]);
    printf("%d",zhishu[zhishu_c-1]);
    return 0;
}